{include="header"}

{if condition="$fsc->first_time"}
<div class="jumbotron">
  <h1>¡Bienvenido a FacturaScripts!</h1>
  <p>
     FacturaScripts tiene un montón de funciones, agrupadas en páginas. Lo mejor
     es que lo actives todo, lo pruebes, y si hay algo que no necesitas y no quieres
     que moleste, simplemente lo desactivas. Recuerda que siempre puedes volver aquí
     desde <b>Admin</b> &gt; <b>Páginas</b>.
  </p>
  <p>
     Y si quieres más, recuerda que tienes los
     <a href="index.php?page=admin_plugins" target="_blank">plugins</a> ;-)
  </p>
  <a href="#" class="btn btn-sm btn-info" onclick="fs_marcar_todo();f_enable_pages.submit();">
     <span class="glyphicon glyphicon-check"></span> &nbsp; Activar todo
  </a>
</div>
{/if}

<script type="text/javascript">
   function fs_marcar_todo()
   {
      $('#f_enable_pages input:checkbox').prop('checked', true);
   }
   function fs_marcar_nada()
   {
      $('#f_enable_pages input:checkbox').prop('checked', false);
   }
</script>

<form id="f_enable_pages" action="{$fsc->url()}" method="post" class="form">
   <input type="hidden" name="modpages" value="TRUE"/>
   <div class="container-fluid" style="margin-top: 10px; margin-bottom: 20px;">
      <div class="row">
         <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
            <div class="btn-group">
               <button class="btn btn-sm btn-default" type="button" onclick="fs_marcar_todo()" title="Marcar todo">
                  <span class="glyphicon glyphicon-check"></span>
               </button>
               <button class="btn btn-sm btn-default" type="button" onclick="fs_marcar_nada()" title="Desmarcar todo">
                  <span class="glyphicon glyphicon-unchecked"></span>
               </button>
            </div>
            
            <a href="index.php?page=admin_plugins" class="btn btn-sm btn-default">
               <span class="glyphicon glyphicon-list-alt"></span> &nbsp; Plugins
            </a>
            
            <a class="btn btn-sm btn-default" href="{$fsc->url()}" title="recargar la página">
               <span class="glyphicon glyphicon-refresh"></span>
            </a>
         </div>
         <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 text-right">
            <button class="btn btn-sm btn-primary" type="submit" onclick="this.disabled=true;this.form.submit();">
               <span class="glyphicon glyphicon-floppy-disk"></span> &nbsp; Guardar
            </button>
         </div>
      </div>
   </div>
   
   <div class="table-responsive">
      <table class="table table-hover">
         <thead>
            <tr>
               <th class="text-left">Página</th>
               <th class="text-left">Menú</th>
               <th class="text-left">Versión</th>
               <th>Importante</th>
               <th>Existe</th>
            </tr>
         </thead>
         {loop="$fsc->paginas"}
         <tr{if condition="!$value->exists"} class="bg-danger"{/if}>
            <td>
               <input class="checkbox-inline" type="checkbox" name="enabled[]" value="{$value->name}"{if condition="$value->enabled"} checked="checked"{/if}/>
               &nbsp; <a target="_blank" href="{$value->url()}">{$value->name}</a>
            </td>
            <td>
               {if condition="$value->show_on_menu"}
                  {$value->folder} » {$value->title}
               {else}
                  -
               {/if}
            </td>
            <td>{$value->version}</td>
            <td class="text-center">
               {if condition="$value->important"}<span class="glyphicon glyphicon-ok"></span>{/if}
            </td>
            <td class="text-center">
               {if condition="$value->exists"}<span class="glyphicon glyphicon-ok"></span>{/if}
            </td>
         </tr>
         {/loop}
      </table>
   </div>
   
   <div class="container-fluid">
      <div class="row">
         <div class="col-lg-10 col-md-10 col-sm-10">
            <div class="btn-group">
               <button class="btn btn-sm btn-default" type="button" onclick="fs_marcar_todo()" title="Marcar todo">
                  <span class="glyphicon glyphicon-check"></span>
               </button>
               <button class="btn btn-sm btn-default" type="button" onclick="fs_marcar_nada()" title="Desmarcar todo">
                  <span class="glyphicon glyphicon-unchecked"></span>
               </button>
            </div>
         </div>
         <div class="col-lg-2 col-md-2 col-sm-2 text-right">
            <button class="btn btn-sm btn-primary" type="submit" onclick="this.disabled=true;this.form.submit();">
               <span class="glyphicon glyphicon-floppy-disk"></span> &nbsp; Guardar
            </button>
         </div>
      </div>
   </div>
</form>

{include="footer"}